package com.hziee.graduate.ticket.controller;



import com.hziee.graduate.ticket.dto.R;
import com.hziee.graduate.ticket.entity.Seat;
import com.hziee.graduate.ticket.service.SeatService;
import com.hziee.graduate.ticket.vo.MovieChartVO;
import com.hziee.graduate.ticket.vo.SeatChartVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("seat")
public class SeatController {

    @Resource
    private SeatService seatService;

    @GetMapping("/getSeatByRoom/{roomId}")
    public R<List<Seat>> getSeatByRoom(@PathVariable Long roomId) {
        return seatService.getSeatByRoom(roomId);
    }

    @GetMapping("/updateSeatStatus/{roomId}/{rowId}/{colId}/{seatStatus}")
    public R<List<Seat>> updateSeatStatus(@PathVariable Long roomId,@PathVariable Long rowId,@PathVariable Long colId,@PathVariable Integer seatStatus) {
        return seatService.updateSeatStatus(roomId, rowId, colId, seatStatus);
    }

    @PostMapping("/getSeatChart")
    public R<List<SeatChartVO>> getSeatChart(
            @RequestBody Map<String, Object> map
    ){
        return seatService.getSeatChart(map);
    }
}

